package com.my.zidingyikongjian.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.FrameLayout;
import android.widget.Toast;

import com.my.zidingyikongjian.R;
import com.my.zidingyikongjian.view.four.MyCanvasTransformation;

public class FourActivity extends AppCompatActivity {
    private String flag;
    private FrameLayout frameLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_four);

        initView();
    }

    private void initView() {
        Intent dataIntent = getIntent();
        flag = dataIntent.getStringExtra("four");
        frameLayout = findViewById(R.id.fl_four);

        if (flag != null) {
            if (flag.equals("1")) { // 平移Canvas
                frameLayout.addView(new MyCanvasTransformation(this, 1));
            } else if (flag.equals("2")) { // 旋转Canvas
                frameLayout.addView(new MyCanvasTransformation(this, 2));
            } else if (flag.equals("3")) { // 旋转Canvas
                frameLayout.addView(new MyCanvasTransformation(this, 3));
            } else if (flag.equals("4")) { // 旋转Canvas
                frameLayout.addView(new MyCanvasTransformation(this, 4));
            } else if (flag.equals("5")) { // 裁剪Canvas
                frameLayout.addView(new MyCanvasTransformation(this, 5));
            } else if (flag.equals("6")) { // 保存与恢复
                frameLayout.addView(new MyCanvasTransformation(this, 6));
            } else if (flag.equals("7")) { // 保存与恢复
                frameLayout.addView(new MyCanvasTransformation(this, 7));
            }
        } else {
            Toast.makeText(this, "flag == null", Toast.LENGTH_SHORT).show();
        }
    }
}
